<template>
  <div class="home">
    <home-header></home-header>
    <home-swiper :listswiper="swiperlist"></home-swiper>
    <home-icons></home-icons>
    <home-recommend :recommentlist="recommentlist"></home-recommend>
    <home-weeked :weekedlist="weekedlist"></home-weeked>
    <bottom-menu></bottom-menu>
  </div>
</template>

<script>
import HomeHeader from '../components/home/homeheader'
import HomeSwiper from '../components/home/homeswiper'
import HomeIcons from '../components/home/icons'
import HomeRecommend from '../components/home/recommend'
import HomeWeeked from '../components/home/weeked'
import BottomMenu from '../components/home/bottommenu'
import axios from 'axios'
// import Bscroll from 'better-scroll'

export default {
  name: 'Home',
  data: function () {
    return {
      swiperlist: [],
      recommentlist: [],
      weekedlist: []
    }
  },
  components: {
    HomeHeader,
    HomeSwiper,
    HomeIcons,
    HomeRecommend,
    HomeWeeked,
    BottomMenu
  },
  beforeMount () {
    this.getswiperinfo()
  },
  methods: {
    getswiperinfo () {
      axios.get('/api/static/mock/index.json').then((res) => {
        const promisedata = res.data
        this.swiperlist = promisedata
      })
      axios.get('/api/static/mock/recomment.json').then((res) => {
        const promisedata = res.data
        this.recommentlist = promisedata.recommentlist
        this.weekedlist = promisedata.weekedlist
      })
    }
  }
}
</script>
